$(document).ready(function(){
$('#role_create_form').submit(function() {
	var role = $('input[name=role]').val();
	var remark = $('textarea[name=remark]').val();

	var role_flag = true;
	$('#role').focus(function() {
		$('#role_msg').empty();
	});
	if(role.toString().length == 0) {
		$('#role_msg').html('<span style="color:red;">角色名不能为空</span>');
		role_flag = false;
	}

	if (role_flag) {
		$.post('/priv/role_create', $('#role_create_form').serialize(), function(data){
					if (data.r == 'succ') {
						alert('操作成功');
					} else {
						alert('操作失败' +  "\n>" +  data.msg.join("\n>"));
					}
				}, 'json');
	}

	return false;
});
});
